﻿Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient
Imports System.Runtime.InteropServices

Public Class frmQuanLySOP
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents btnNew As System.Windows.Forms.Button
    Friend WithEvents btnSave As System.Windows.Forms.Button
    Friend WithEvents btnDelete1 As System.Windows.Forms.Button
    Friend WithEvents txtMaQuanLy As System.Windows.Forms.TextBox
    Friend WithEvents txtNoiLuu As System.Windows.Forms.TextBox
    Friend WithEvents BtnClose As System.Windows.Forms.Button
    Friend WithEvents MatinhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TentinhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MamienDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView
    Friend WithEvents DataSetForm_Sop As MEKONG.DataSetForm_Sop
    Friend WithEvents TxtTenTaiLieu As System.Windows.Forms.TextBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents TxtSoBan As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents TblquanlysopBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents DPTNgayBanHanh As System.Windows.Forms.DateTimePicker
    Friend WithEvents TxtNgayBanHanh As System.Windows.Forms.MaskedTextBox
    Friend WithEvents DPTNgayCapNhat As System.Windows.Forms.DateTimePicker
    Friend WithEvents TxtNgayCapNhat As System.Windows.Forms.MaskedTextBox
    Friend WithEvents openFile As System.Windows.Forms.OpenFileDialog
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents TabMain As System.Windows.Forms.TabControl
    Friend WithEvents TabThongTin As System.Windows.Forms.TabPage
    Friend WithEvents TabTimKiem As System.Windows.Forms.TabPage
    Friend WithEvents gridSearch As System.Windows.Forms.DataGridView
    Friend WithEvents DataSetSearch As MEKONG.DataSetSearch
    Friend WithEvents MaquanlyDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MasotailieuDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TentailieuDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents BansoDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents NgaybanhanhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents NgaycapnhatDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents NoiluuDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents comboMa As ATI7ColumnsComboBox
    Friend WithEvents txtMaQL As System.Windows.Forms.TextBox
    Friend WithEvents optMaQL As System.Windows.Forms.RadioButton
    Friend WithEvents TblquanlySOPSearchBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents optLoai As System.Windows.Forms.RadioButton
    Friend WithEvents optSo As System.Windows.Forms.RadioButton
    Friend WithEvents optLan As System.Windows.Forms.RadioButton
    Friend WithEvents optBophan As System.Windows.Forms.RadioButton
    Friend WithEvents optMa As System.Windows.Forms.RadioButton
    Friend WithEvents txtMaSearch As System.Windows.Forms.TextBox
    Friend WithEvents CboSoLanBanHanh As MTGCComboBox
    Friend WithEvents TxtSoLanBanHanh As System.Windows.Forms.TextBox
    Friend WithEvents TxtSoThuTu As System.Windows.Forms.TextBox
    Friend WithEvents CboLoaiTaiLieu As MTGCComboBox
    Friend WithEvents TxtTenLoaiTaiLieu As System.Windows.Forms.TextBox
    Friend WithEvents CboBoPhanBanHanh As MTGCComboBox
    Friend WithEvents TxtTenBoPhanBanHanh As System.Windows.Forms.TextBox
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents btnTimKiem As System.Windows.Forms.Button
    Friend WithEvents MaquanlyDataGridViewTextBoxColumn1 As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MatailieuDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents tentailieu As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents SothutuDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents BtnIn As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmQuanLySOP))
        Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Me.btnSave = New System.Windows.Forms.Button
        Me.txtNoiLuu = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.txtMaQuanLy = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.btnNew = New System.Windows.Forms.Button
        Me.btnDelete1 = New System.Windows.Forms.Button
        Me.BtnClose = New System.Windows.Forms.Button
        Me.BtnIn = New System.Windows.Forms.Button
        Me.DataGridView1 = New System.Windows.Forms.DataGridView
        Me.MaquanlyDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.MasotailieuDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TentailieuDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.BansoDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.NgaybanhanhDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.NgaycapnhatDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.NoiluuDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TblquanlysopBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.DataSetForm_Sop = New MEKONG.DataSetForm_Sop
        Me.TxtTenTaiLieu = New System.Windows.Forms.TextBox
        Me.Label5 = New System.Windows.Forms.Label
        Me.TxtSoBan = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.Label8 = New System.Windows.Forms.Label
        Me.Button1 = New System.Windows.Forms.Button
        Me.DPTNgayBanHanh = New System.Windows.Forms.DateTimePicker
        Me.TxtNgayBanHanh = New System.Windows.Forms.MaskedTextBox
        Me.DPTNgayCapNhat = New System.Windows.Forms.DateTimePicker
        Me.TxtNgayCapNhat = New System.Windows.Forms.MaskedTextBox
        Me.openFile = New System.Windows.Forms.OpenFileDialog
        Me.Button2 = New System.Windows.Forms.Button
        Me.TabMain = New System.Windows.Forms.TabControl
        Me.TabThongTin = New System.Windows.Forms.TabPage
        Me.comboMa = New ATI7ColumnsComboBox
        Me.TabTimKiem = New System.Windows.Forms.TabPage
        Me.Button3 = New System.Windows.Forms.Button
        Me.btnTimKiem = New System.Windows.Forms.Button
        Me.optLoai = New System.Windows.Forms.RadioButton
        Me.optSo = New System.Windows.Forms.RadioButton
        Me.optLan = New System.Windows.Forms.RadioButton
        Me.optBophan = New System.Windows.Forms.RadioButton
        Me.optMa = New System.Windows.Forms.RadioButton
        Me.txtMaSearch = New System.Windows.Forms.TextBox
        Me.CboSoLanBanHanh = New MTGCComboBox
        Me.TxtSoLanBanHanh = New System.Windows.Forms.TextBox
        Me.TxtSoThuTu = New System.Windows.Forms.TextBox
        Me.CboLoaiTaiLieu = New MTGCComboBox
        Me.TxtTenLoaiTaiLieu = New System.Windows.Forms.TextBox
        Me.CboBoPhanBanHanh = New MTGCComboBox
        Me.TxtTenBoPhanBanHanh = New System.Windows.Forms.TextBox
        Me.optMaQL = New System.Windows.Forms.RadioButton
        Me.txtMaQL = New System.Windows.Forms.TextBox
        Me.Button4 = New System.Windows.Forms.Button
        Me.gridSearch = New System.Windows.Forms.DataGridView
        Me.MaquanlyDataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.MatailieuDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.tentailieu = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.SothutuDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TblquanlySOPSearchBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.DataSetSearch = New MEKONG.DataSetSearch
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.TblquanlysopBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DataSetForm_Sop, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.TabMain.SuspendLayout()
        Me.TabThongTin.SuspendLayout()
        Me.TabTimKiem.SuspendLayout()
        CType(Me.gridSearch, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.TblquanlySOPSearchBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DataSetSearch, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'btnSave
        '
        Me.btnSave.BackColor = System.Drawing.Color.Transparent
        Me.btnSave.Image = CType(resources.GetObject("btnSave.Image"), System.Drawing.Image)
        Me.btnSave.Location = New System.Drawing.Point(195, 437)
        Me.btnSave.Name = "btnSave"
        Me.btnSave.Size = New System.Drawing.Size(96, 24)
        Me.btnSave.TabIndex = 9
        Me.btnSave.UseVisualStyleBackColor = False
        '
        'txtNoiLuu
        '
        Me.txtNoiLuu.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtNoiLuu.Location = New System.Drawing.Point(75, 90)
        Me.txtNoiLuu.MaxLength = 100
        Me.txtNoiLuu.Name = "txtNoiLuu"
        Me.txtNoiLuu.Size = New System.Drawing.Size(406, 22)
        Me.txtNoiLuu.TabIndex = 7
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(13, 93)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(61, 16)
        Me.Label4.TabIndex = 16
        Me.Label4.Text = "Tên tập tin"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(1, 38)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 17)
        Me.Label3.TabIndex = 14
        Me.Label3.Text = "Mã Tài Liệu"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'txtMaQuanLy
        '
        Me.txtMaQuanLy.BackColor = System.Drawing.SystemColors.Info
        Me.txtMaQuanLy.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtMaQuanLy.ForeColor = System.Drawing.Color.Red
        Me.txtMaQuanLy.Location = New System.Drawing.Point(75, 6)
        Me.txtMaQuanLy.MaxLength = 10
        Me.txtMaQuanLy.Name = "txtMaQuanLy"
        Me.txtMaQuanLy.Size = New System.Drawing.Size(104, 25)
        Me.txtMaQuanLy.TabIndex = 1
        Me.txtMaQuanLy.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(0, 6)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(74, 19)
        Me.Label2.TabIndex = 12
        Me.Label2.Text = "Mã Quản Lý"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(201, 9)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(416, 24)
        Me.Label1.TabIndex = 11
        Me.Label1.Text = "DANH MỤC QUẢN LÝ TÀI LIỆU SOP"
        '
        'btnNew
        '
        Me.btnNew.Image = CType(resources.GetObject("btnNew.Image"), System.Drawing.Image)
        Me.btnNew.Location = New System.Drawing.Point(75, 437)
        Me.btnNew.Name = "btnNew"
        Me.btnNew.Size = New System.Drawing.Size(96, 24)
        Me.btnNew.TabIndex = 50
        '
        'btnDelete1
        '
        Me.btnDelete1.Image = CType(resources.GetObject("btnDelete1.Image"), System.Drawing.Image)
        Me.btnDelete1.Location = New System.Drawing.Point(315, 437)
        Me.btnDelete1.Name = "btnDelete1"
        Me.btnDelete1.Size = New System.Drawing.Size(88, 24)
        Me.btnDelete1.TabIndex = 29
        '
        'BtnClose
        '
        Me.BtnClose.Image = CType(resources.GetObject("BtnClose.Image"), System.Drawing.Image)
        Me.BtnClose.Location = New System.Drawing.Point(547, 437)
        Me.BtnClose.Name = "BtnClose"
        Me.BtnClose.Size = New System.Drawing.Size(88, 24)
        Me.BtnClose.TabIndex = 30
        '
        'BtnIn
        '
        Me.BtnIn.Image = CType(resources.GetObject("BtnIn.Image"), System.Drawing.Image)
        Me.BtnIn.Location = New System.Drawing.Point(435, 437)
        Me.BtnIn.Name = "BtnIn"
        Me.BtnIn.Size = New System.Drawing.Size(88, 24)
        Me.BtnIn.TabIndex = 39
        '
        'DataGridView1
        '
        Me.DataGridView1.AllowUserToAddRows = False
        Me.DataGridView1.AllowUserToDeleteRows = False
        Me.DataGridView1.AllowUserToResizeColumns = False
        Me.DataGridView1.AutoGenerateColumns = False
        Me.DataGridView1.BackgroundColor = System.Drawing.Color.LightBlue
        Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
        Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.MaquanlyDataGridViewTextBoxColumn, Me.MasotailieuDataGridViewTextBoxColumn, Me.TentailieuDataGridViewTextBoxColumn, Me.BansoDataGridViewTextBoxColumn, Me.NgaybanhanhDataGridViewTextBoxColumn, Me.NgaycapnhatDataGridViewTextBoxColumn, Me.NoiluuDataGridViewTextBoxColumn})
        Me.DataGridView1.DataSource = Me.TblquanlysopBindingSource
        Me.DataGridView1.Location = New System.Drawing.Point(16, 120)
        Me.DataGridView1.Name = "DataGridView1"
        Me.DataGridView1.ReadOnly = True
        Me.DataGridView1.Size = New System.Drawing.Size(760, 299)
        Me.DataGridView1.TabIndex = 40
        '
        'MaquanlyDataGridViewTextBoxColumn
        '
        Me.MaquanlyDataGridViewTextBoxColumn.DataPropertyName = "maquanly"
        Me.MaquanlyDataGridViewTextBoxColumn.HeaderText = "Mã quản lý"
        Me.MaquanlyDataGridViewTextBoxColumn.Name = "MaquanlyDataGridViewTextBoxColumn"
        Me.MaquanlyDataGridViewTextBoxColumn.ReadOnly = True
        Me.MaquanlyDataGridViewTextBoxColumn.Width = 80
        '
        'MasotailieuDataGridViewTextBoxColumn
        '
        Me.MasotailieuDataGridViewTextBoxColumn.DataPropertyName = "masotailieu"
        Me.MasotailieuDataGridViewTextBoxColumn.HeaderText = "Mã tài liệu"
        Me.MasotailieuDataGridViewTextBoxColumn.Name = "MasotailieuDataGridViewTextBoxColumn"
        Me.MasotailieuDataGridViewTextBoxColumn.ReadOnly = True
        Me.MasotailieuDataGridViewTextBoxColumn.Width = 80
        '
        'TentailieuDataGridViewTextBoxColumn
        '
        Me.TentailieuDataGridViewTextBoxColumn.DataPropertyName = "tentailieu"
        Me.TentailieuDataGridViewTextBoxColumn.HeaderText = "Tên tài liệu"
        Me.TentailieuDataGridViewTextBoxColumn.Name = "TentailieuDataGridViewTextBoxColumn"
        Me.TentailieuDataGridViewTextBoxColumn.ReadOnly = True
        Me.TentailieuDataGridViewTextBoxColumn.Width = 200
        '
        'BansoDataGridViewTextBoxColumn
        '
        Me.BansoDataGridViewTextBoxColumn.DataPropertyName = "banso"
        Me.BansoDataGridViewTextBoxColumn.HeaderText = "Bản số"
        Me.BansoDataGridViewTextBoxColumn.Name = "BansoDataGridViewTextBoxColumn"
        Me.BansoDataGridViewTextBoxColumn.ReadOnly = True
        Me.BansoDataGridViewTextBoxColumn.Width = 50
        '
        'NgaybanhanhDataGridViewTextBoxColumn
        '
        Me.NgaybanhanhDataGridViewTextBoxColumn.DataPropertyName = "ngaybanhanh"
        Me.NgaybanhanhDataGridViewTextBoxColumn.HeaderText = "Ngày ban hành"
        Me.NgaybanhanhDataGridViewTextBoxColumn.Name = "NgaybanhanhDataGridViewTextBoxColumn"
        Me.NgaybanhanhDataGridViewTextBoxColumn.ReadOnly = True
        Me.NgaybanhanhDataGridViewTextBoxColumn.Width = 70
        '
        'NgaycapnhatDataGridViewTextBoxColumn
        '
        Me.NgaycapnhatDataGridViewTextBoxColumn.DataPropertyName = "ngaycapnhat"
        Me.NgaycapnhatDataGridViewTextBoxColumn.HeaderText = "Ngày cập nhật"
        Me.NgaycapnhatDataGridViewTextBoxColumn.Name = "NgaycapnhatDataGridViewTextBoxColumn"
        Me.NgaycapnhatDataGridViewTextBoxColumn.ReadOnly = True
        Me.NgaycapnhatDataGridViewTextBoxColumn.Width = 70
        '
        'NoiluuDataGridViewTextBoxColumn
        '
        Me.NoiluuDataGridViewTextBoxColumn.DataPropertyName = "noiluu"
        Me.NoiluuDataGridViewTextBoxColumn.HeaderText = "Nơi lưu"
        Me.NoiluuDataGridViewTextBoxColumn.Name = "NoiluuDataGridViewTextBoxColumn"
        Me.NoiluuDataGridViewTextBoxColumn.ReadOnly = True
        Me.NoiluuDataGridViewTextBoxColumn.Width = 144
        '
        'TblquanlysopBindingSource
        '
        Me.TblquanlysopBindingSource.DataMember = "tbl_quanlysop"
        Me.TblquanlysopBindingSource.DataSource = Me.DataSetForm_Sop
        '
        'DataSetForm_Sop
        '
        Me.DataSetForm_Sop.DataSetName = "DataSetForm_Sop"
        Me.DataSetForm_Sop.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
        '
        'TxtTenTaiLieu
        '
        Me.TxtTenTaiLieu.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtTenTaiLieu.Location = New System.Drawing.Point(265, 33)
        Me.TxtTenTaiLieu.MaxLength = 50
        Me.TxtTenTaiLieu.Name = "TxtTenTaiLieu"
        Me.TxtTenTaiLieu.Size = New System.Drawing.Size(419, 22)
        Me.TxtTenTaiLieu.TabIndex = 3
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(184, 33)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(75, 20)
        Me.Label5.TabIndex = 42
        Me.Label5.Text = "Tên Tài Liệu"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'TxtSoBan
        '
        Me.TxtSoBan.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtSoBan.Location = New System.Drawing.Point(75, 62)
        Me.TxtSoBan.MaxLength = 50
        Me.TxtSoBan.Name = "TxtSoBan"
        Me.TxtSoBan.Size = New System.Drawing.Size(103, 22)
        Me.TxtSoBan.TabIndex = 4
        Me.TxtSoBan.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(9, 65)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(59, 17)
        Me.Label6.TabIndex = 44
        Me.Label6.Text = "Số Bản"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(178, 64)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(86, 17)
        Me.Label7.TabIndex = 46
        Me.Label7.Text = "Ngày Ban Hành"
        Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(423, 63)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(85, 18)
        Me.Label8.TabIndex = 48
        Me.Label8.Text = "Ngày Cập nhật"
        Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Button1
        '
        Me.Button1.BackColor = System.Drawing.Color.Transparent
        Me.Button1.Image = Global.MEKONG.My.Resources.Resources.open_doc
        Me.Button1.Location = New System.Drawing.Point(589, 90)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(96, 24)
        Me.Button1.TabIndex = 49
        Me.Button1.UseVisualStyleBackColor = False
        '
        'DPTNgayBanHanh
        '
        Me.DPTNgayBanHanh.CustomFormat = "dd/mm/yyyy"
        Me.DPTNgayBanHanh.Format = System.Windows.Forms.DateTimePickerFormat.Custom
        Me.DPTNgayBanHanh.Location = New System.Drawing.Point(391, 63)
        Me.DPTNgayBanHanh.Name = "DPTNgayBanHanh"
        Me.DPTNgayBanHanh.Size = New System.Drawing.Size(23, 20)
        Me.DPTNgayBanHanh.TabIndex = 58
        '
        'TxtNgayBanHanh
        '
        Me.TxtNgayBanHanh.Location = New System.Drawing.Point(265, 63)
        Me.TxtNgayBanHanh.Mask = "00/00/0000"
        Me.TxtNgayBanHanh.Name = "TxtNgayBanHanh"
        Me.TxtNgayBanHanh.Size = New System.Drawing.Size(120, 20)
        Me.TxtNgayBanHanh.TabIndex = 5
        Me.TxtNgayBanHanh.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'DPTNgayCapNhat
        '
        Me.DPTNgayCapNhat.CustomFormat = "dd/mm/yyyy"
        Me.DPTNgayCapNhat.Format = System.Windows.Forms.DateTimePickerFormat.Custom
        Me.DPTNgayCapNhat.Location = New System.Drawing.Point(661, 64)
        Me.DPTNgayCapNhat.Name = "DPTNgayCapNhat"
        Me.DPTNgayCapNhat.Size = New System.Drawing.Size(23, 20)
        Me.DPTNgayCapNhat.TabIndex = 60
        '
        'TxtNgayCapNhat
        '
        Me.TxtNgayCapNhat.Location = New System.Drawing.Point(513, 63)
        Me.TxtNgayCapNhat.Mask = "00/00/0000"
        Me.TxtNgayCapNhat.Name = "TxtNgayCapNhat"
        Me.TxtNgayCapNhat.Size = New System.Drawing.Size(142, 20)
        Me.TxtNgayCapNhat.TabIndex = 6
        Me.TxtNgayCapNhat.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'Button2
        '
        Me.Button2.BackColor = System.Drawing.Color.Transparent
        Me.Button2.Image = Global.MEKONG.My.Resources.Resources.search_doc
        Me.Button2.Location = New System.Drawing.Point(487, 90)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(96, 24)
        Me.Button2.TabIndex = 8
        Me.Button2.UseVisualStyleBackColor = False
        '
        'TabMain
        '
        Me.TabMain.Controls.Add(Me.TabThongTin)
        Me.TabMain.Controls.Add(Me.TabTimKiem)
        Me.TabMain.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TabMain.Location = New System.Drawing.Point(0, 49)
        Me.TabMain.Name = "TabMain"
        Me.TabMain.SelectedIndex = 0
        Me.TabMain.Size = New System.Drawing.Size(794, 528)
        Me.TabMain.TabIndex = 62
        '
        'TabThongTin
        '
        Me.TabThongTin.BackColor = System.Drawing.Color.LightBlue
        Me.TabThongTin.Controls.Add(Me.comboMa)
        Me.TabThongTin.Controls.Add(Me.txtMaQuanLy)
        Me.TabThongTin.Controls.Add(Me.Button2)
        Me.TabThongTin.Controls.Add(Me.Label2)
        Me.TabThongTin.Controls.Add(Me.DPTNgayCapNhat)
        Me.TabThongTin.Controls.Add(Me.Label3)
        Me.TabThongTin.Controls.Add(Me.TxtNgayCapNhat)
        Me.TabThongTin.Controls.Add(Me.Label4)
        Me.TabThongTin.Controls.Add(Me.DPTNgayBanHanh)
        Me.TabThongTin.Controls.Add(Me.btnSave)
        Me.TabThongTin.Controls.Add(Me.TxtNgayBanHanh)
        Me.TabThongTin.Controls.Add(Me.btnNew)
        Me.TabThongTin.Controls.Add(Me.Button1)
        Me.TabThongTin.Controls.Add(Me.btnDelete1)
        Me.TabThongTin.Controls.Add(Me.Label8)
        Me.TabThongTin.Controls.Add(Me.Label7)
        Me.TabThongTin.Controls.Add(Me.txtNoiLuu)
        Me.TabThongTin.Controls.Add(Me.TxtSoBan)
        Me.TabThongTin.Controls.Add(Me.BtnClose)
        Me.TabThongTin.Controls.Add(Me.Label6)
        Me.TabThongTin.Controls.Add(Me.BtnIn)
        Me.TabThongTin.Controls.Add(Me.TxtTenTaiLieu)
        Me.TabThongTin.Controls.Add(Me.DataGridView1)
        Me.TabThongTin.Controls.Add(Me.Label5)
        Me.TabThongTin.Location = New System.Drawing.Point(4, 22)
        Me.TabThongTin.Name = "TabThongTin"
        Me.TabThongTin.Padding = New System.Windows.Forms.Padding(3)
        Me.TabThongTin.Size = New System.Drawing.Size(786, 502)
        Me.TabThongTin.TabIndex = 0
        Me.TabThongTin.Text = "Thông tin"
        '
        'comboMa
        '
        Me.comboMa.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.comboMa.ArrowColor = System.Drawing.Color.Black
        Me.comboMa.BindedControl = Nothing
        Me.comboMa.BorderStyle = ATI7ColumnsComboBox.TipiBordi.Fixed3D
        Me.comboMa.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.comboMa.ColumnNum = 1
        Me.comboMa.ColumnWidth = "121"
        Me.comboMa.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.comboMa.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.comboMa.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.comboMa.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.comboMa.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.comboMa.DisplayMember = "Text"
        Me.comboMa.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.comboMa.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.comboMa.DropDownForeColor = System.Drawing.Color.Black
        Me.comboMa.DropDownStyle = ATI7ColumnsComboBox.CustomDropDownStyle.DropDown
        Me.comboMa.DropDownWidth = 141
        Me.comboMa.GridLineColor = System.Drawing.Color.LightGray
        Me.comboMa.GridLineHorizontal = False
        Me.comboMa.GridLineVertical = False
        Me.comboMa.LoadingType = ATI7ColumnsComboBox.CaricamentoCombo.ComboBoxItem
        Me.comboMa.Location = New System.Drawing.Point(75, 35)
        Me.comboMa.ManagingFastMouseMoving = True
        Me.comboMa.ManagingFastMouseMovingInterval = 30
        Me.comboMa.Name = "comboMa"
        Me.comboMa.SelectedItem = Nothing
        Me.comboMa.SelectedValue = Nothing
        Me.comboMa.Size = New System.Drawing.Size(104, 21)
        Me.comboMa.TabIndex = 2
        '
        'TabTimKiem
        '
        Me.TabTimKiem.BackColor = System.Drawing.Color.LightBlue
        Me.TabTimKiem.Controls.Add(Me.Button3)
        Me.TabTimKiem.Controls.Add(Me.btnTimKiem)
        Me.TabTimKiem.Controls.Add(Me.optLoai)
        Me.TabTimKiem.Controls.Add(Me.optSo)
        Me.TabTimKiem.Controls.Add(Me.optLan)
        Me.TabTimKiem.Controls.Add(Me.optBophan)
        Me.TabTimKiem.Controls.Add(Me.optMa)
        Me.TabTimKiem.Controls.Add(Me.txtMaSearch)
        Me.TabTimKiem.Controls.Add(Me.CboSoLanBanHanh)
        Me.TabTimKiem.Controls.Add(Me.TxtSoLanBanHanh)
        Me.TabTimKiem.Controls.Add(Me.TxtSoThuTu)
        Me.TabTimKiem.Controls.Add(Me.CboLoaiTaiLieu)
        Me.TabTimKiem.Controls.Add(Me.TxtTenLoaiTaiLieu)
        Me.TabTimKiem.Controls.Add(Me.CboBoPhanBanHanh)
        Me.TabTimKiem.Controls.Add(Me.TxtTenBoPhanBanHanh)
        Me.TabTimKiem.Controls.Add(Me.optMaQL)
        Me.TabTimKiem.Controls.Add(Me.txtMaQL)
        Me.TabTimKiem.Controls.Add(Me.Button4)
        Me.TabTimKiem.Controls.Add(Me.gridSearch)
        Me.TabTimKiem.Location = New System.Drawing.Point(4, 22)
        Me.TabTimKiem.Name = "TabTimKiem"
        Me.TabTimKiem.Padding = New System.Windows.Forms.Padding(3)
        Me.TabTimKiem.Size = New System.Drawing.Size(786, 502)
        Me.TabTimKiem.TabIndex = 1
        Me.TabTimKiem.Text = "Tìm kiếm"
        '
        'Button3
        '
        Me.Button3.BackColor = System.Drawing.Color.Transparent
        Me.Button3.Image = Global.MEKONG.My.Resources.Resources.open_doc
        Me.Button3.Location = New System.Drawing.Point(406, 179)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(100, 24)
        Me.Button3.TabIndex = 148
        Me.Button3.UseVisualStyleBackColor = False
        '
        'btnTimKiem
        '
        Me.btnTimKiem.Image = Global.MEKONG.My.Resources.Resources.tim
        Me.btnTimKiem.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnTimKiem.Location = New System.Drawing.Point(230, 177)
        Me.btnTimKiem.Name = "btnTimKiem"
        Me.btnTimKiem.Size = New System.Drawing.Size(138, 26)
        Me.btnTimKiem.TabIndex = 147
        Me.btnTimKiem.Text = "Tìm kiếm..."
        Me.btnTimKiem.UseVisualStyleBackColor = True
        '
        'optLoai
        '
        Me.optLoai.AutoSize = True
        Me.optLoai.Location = New System.Drawing.Point(70, 102)
        Me.optLoai.Name = "optLoai"
        Me.optLoai.Size = New System.Drawing.Size(130, 17)
        Me.optLoai.TabIndex = 146
        Me.optLoai.TabStop = True
        Me.optLoai.Text = "Tìm theo Loại Tài Liệu"
        Me.optLoai.UseVisualStyleBackColor = True
        '
        'optSo
        '
        Me.optSo.AutoSize = True
        Me.optSo.Location = New System.Drawing.Point(70, 126)
        Me.optSo.Name = "optSo"
        Me.optSo.Size = New System.Drawing.Size(138, 17)
        Me.optSo.TabIndex = 145
        Me.optSo.TabStop = True
        Me.optSo.Text = "Tìm theo Số Thứ Tự BH"
        Me.optSo.UseVisualStyleBackColor = True
        '
        'optLan
        '
        Me.optLan.AutoSize = True
        Me.optLan.Location = New System.Drawing.Point(70, 152)
        Me.optLan.Name = "optLan"
        Me.optLan.Size = New System.Drawing.Size(121, 17)
        Me.optLan.TabIndex = 144
        Me.optLan.TabStop = True
        Me.optLan.Text = "Tìm theo Số Lần BH"
        Me.optLan.UseVisualStyleBackColor = True
        '
        'optBophan
        '
        Me.optBophan.AutoSize = True
        Me.optBophan.Location = New System.Drawing.Point(70, 76)
        Me.optBophan.Name = "optBophan"
        Me.optBophan.Size = New System.Drawing.Size(161, 17)
        Me.optBophan.TabIndex = 143
        Me.optBophan.TabStop = True
        Me.optBophan.Text = "Tìm theo Bộ Phận Ban Hành"
        Me.optBophan.UseVisualStyleBackColor = True
        '
        'optMa
        '
        Me.optMa.AutoSize = True
        Me.optMa.Location = New System.Drawing.Point(70, 48)
        Me.optMa.Name = "optMa"
        Me.optMa.Size = New System.Drawing.Size(153, 17)
        Me.optMa.TabIndex = 142
        Me.optMa.TabStop = True
        Me.optMa.Text = "Tìm theo  Mã Tài Liệu SOP"
        Me.optMa.UseVisualStyleBackColor = True
        '
        'txtMaSearch
        '
        Me.txtMaSearch.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtMaSearch.Location = New System.Drawing.Point(231, 45)
        Me.txtMaSearch.MaxLength = 50
        Me.txtMaSearch.Name = "txtMaSearch"
        Me.txtMaSearch.Size = New System.Drawing.Size(138, 22)
        Me.txtMaSearch.TabIndex = 141
        '
        'CboSoLanBanHanh
        '
        Me.CboSoLanBanHanh.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.CboSoLanBanHanh.ArrowColor = System.Drawing.Color.Black
        Me.CboSoLanBanHanh.BindedControl = Nothing
        Me.CboSoLanBanHanh.BorderStyle = MTGCComboBox.TipiBordi.Fixed3D
        Me.CboSoLanBanHanh.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.CboSoLanBanHanh.ColumnNum = 1
        Me.CboSoLanBanHanh.ColumnWidth = "121"
        Me.CboSoLanBanHanh.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.CboSoLanBanHanh.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.CboSoLanBanHanh.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.CboSoLanBanHanh.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.CboSoLanBanHanh.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.CboSoLanBanHanh.DisplayMember = "Text"
        Me.CboSoLanBanHanh.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.CboSoLanBanHanh.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.CboSoLanBanHanh.DropDownForeColor = System.Drawing.Color.Black
        Me.CboSoLanBanHanh.DropDownStyle = MTGCComboBox.CustomDropDownStyle.DropDown
        Me.CboSoLanBanHanh.DropDownWidth = 141
        Me.CboSoLanBanHanh.GridLineColor = System.Drawing.Color.LightGray
        Me.CboSoLanBanHanh.GridLineHorizontal = False
        Me.CboSoLanBanHanh.GridLineVertical = False
        Me.CboSoLanBanHanh.LoadingType = MTGCComboBox.CaricamentoCombo.ComboBoxItem
        Me.CboSoLanBanHanh.Location = New System.Drawing.Point(230, 150)
        Me.CboSoLanBanHanh.ManagingFastMouseMoving = True
        Me.CboSoLanBanHanh.ManagingFastMouseMovingInterval = 30
        Me.CboSoLanBanHanh.Name = "CboSoLanBanHanh"
        Me.CboSoLanBanHanh.SelectedItem = Nothing
        Me.CboSoLanBanHanh.SelectedValue = Nothing
        Me.CboSoLanBanHanh.Size = New System.Drawing.Size(138, 21)
        Me.CboSoLanBanHanh.TabIndex = 140
        '
        'TxtSoLanBanHanh
        '
        Me.TxtSoLanBanHanh.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtSoLanBanHanh.Location = New System.Drawing.Point(374, 149)
        Me.TxtSoLanBanHanh.MaxLength = 50
        Me.TxtSoLanBanHanh.Name = "TxtSoLanBanHanh"
        Me.TxtSoLanBanHanh.Size = New System.Drawing.Size(397, 22)
        Me.TxtSoLanBanHanh.TabIndex = 139
        '
        'TxtSoThuTu
        '
        Me.TxtSoThuTu.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtSoThuTu.Location = New System.Drawing.Point(231, 123)
        Me.TxtSoThuTu.MaxLength = 50
        Me.TxtSoThuTu.Name = "TxtSoThuTu"
        Me.TxtSoThuTu.Size = New System.Drawing.Size(138, 22)
        Me.TxtSoThuTu.TabIndex = 138
        '
        'CboLoaiTaiLieu
        '
        Me.CboLoaiTaiLieu.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.CboLoaiTaiLieu.ArrowColor = System.Drawing.Color.Black
        Me.CboLoaiTaiLieu.BindedControl = Nothing
        Me.CboLoaiTaiLieu.BorderStyle = MTGCComboBox.TipiBordi.Fixed3D
        Me.CboLoaiTaiLieu.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.CboLoaiTaiLieu.ColumnNum = 1
        Me.CboLoaiTaiLieu.ColumnWidth = "121"
        Me.CboLoaiTaiLieu.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.CboLoaiTaiLieu.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.CboLoaiTaiLieu.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.CboLoaiTaiLieu.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.CboLoaiTaiLieu.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.CboLoaiTaiLieu.DisplayMember = "Text"
        Me.CboLoaiTaiLieu.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.CboLoaiTaiLieu.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.CboLoaiTaiLieu.DropDownForeColor = System.Drawing.Color.Black
        Me.CboLoaiTaiLieu.DropDownStyle = MTGCComboBox.CustomDropDownStyle.DropDown
        Me.CboLoaiTaiLieu.DropDownWidth = 141
        Me.CboLoaiTaiLieu.GridLineColor = System.Drawing.Color.LightGray
        Me.CboLoaiTaiLieu.GridLineHorizontal = False
        Me.CboLoaiTaiLieu.GridLineVertical = False
        Me.CboLoaiTaiLieu.LoadingType = MTGCComboBox.CaricamentoCombo.ComboBoxItem
        Me.CboLoaiTaiLieu.Location = New System.Drawing.Point(230, 97)
        Me.CboLoaiTaiLieu.ManagingFastMouseMoving = True
        Me.CboLoaiTaiLieu.ManagingFastMouseMovingInterval = 30
        Me.CboLoaiTaiLieu.Name = "CboLoaiTaiLieu"
        Me.CboLoaiTaiLieu.SelectedItem = Nothing
        Me.CboLoaiTaiLieu.SelectedValue = Nothing
        Me.CboLoaiTaiLieu.Size = New System.Drawing.Size(138, 21)
        Me.CboLoaiTaiLieu.TabIndex = 137
        '
        'TxtTenLoaiTaiLieu
        '
        Me.TxtTenLoaiTaiLieu.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtTenLoaiTaiLieu.Location = New System.Drawing.Point(374, 96)
        Me.TxtTenLoaiTaiLieu.MaxLength = 50
        Me.TxtTenLoaiTaiLieu.Name = "TxtTenLoaiTaiLieu"
        Me.TxtTenLoaiTaiLieu.Size = New System.Drawing.Size(397, 22)
        Me.TxtTenLoaiTaiLieu.TabIndex = 136
        '
        'CboBoPhanBanHanh
        '
        Me.CboBoPhanBanHanh.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.CboBoPhanBanHanh.ArrowColor = System.Drawing.Color.Black
        Me.CboBoPhanBanHanh.BindedControl = Nothing
        Me.CboBoPhanBanHanh.BorderStyle = MTGCComboBox.TipiBordi.Fixed3D
        Me.CboBoPhanBanHanh.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.CboBoPhanBanHanh.ColumnNum = 1
        Me.CboBoPhanBanHanh.ColumnWidth = "121"
        Me.CboBoPhanBanHanh.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.CboBoPhanBanHanh.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.CboBoPhanBanHanh.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.CboBoPhanBanHanh.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.CboBoPhanBanHanh.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.CboBoPhanBanHanh.DisplayMember = "Text"
        Me.CboBoPhanBanHanh.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.CboBoPhanBanHanh.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.CboBoPhanBanHanh.DropDownForeColor = System.Drawing.Color.Black
        Me.CboBoPhanBanHanh.DropDownStyle = MTGCComboBox.CustomDropDownStyle.DropDown
        Me.CboBoPhanBanHanh.DropDownWidth = 141
        Me.CboBoPhanBanHanh.GridLineColor = System.Drawing.Color.LightGray
        Me.CboBoPhanBanHanh.GridLineHorizontal = False
        Me.CboBoPhanBanHanh.GridLineVertical = False
        Me.CboBoPhanBanHanh.LoadingType = MTGCComboBox.CaricamentoCombo.ComboBoxItem
        Me.CboBoPhanBanHanh.Location = New System.Drawing.Point(231, 71)
        Me.CboBoPhanBanHanh.ManagingFastMouseMoving = True
        Me.CboBoPhanBanHanh.ManagingFastMouseMovingInterval = 30
        Me.CboBoPhanBanHanh.Name = "CboBoPhanBanHanh"
        Me.CboBoPhanBanHanh.SelectedItem = Nothing
        Me.CboBoPhanBanHanh.SelectedValue = Nothing
        Me.CboBoPhanBanHanh.Size = New System.Drawing.Size(138, 21)
        Me.CboBoPhanBanHanh.TabIndex = 135
        '
        'TxtTenBoPhanBanHanh
        '
        Me.TxtTenBoPhanBanHanh.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtTenBoPhanBanHanh.Location = New System.Drawing.Point(375, 70)
        Me.TxtTenBoPhanBanHanh.MaxLength = 50
        Me.TxtTenBoPhanBanHanh.Name = "TxtTenBoPhanBanHanh"
        Me.TxtTenBoPhanBanHanh.Size = New System.Drawing.Size(397, 22)
        Me.TxtTenBoPhanBanHanh.TabIndex = 134
        '
        'optMaQL
        '
        Me.optMaQL.AutoSize = True
        Me.optMaQL.Location = New System.Drawing.Point(70, 22)
        Me.optMaQL.Name = "optMaQL"
        Me.optMaQL.Size = New System.Drawing.Size(127, 17)
        Me.optMaQL.TabIndex = 132
        Me.optMaQL.TabStop = True
        Me.optMaQL.Text = "Tìm theo Mã Quản Lý"
        Me.optMaQL.UseVisualStyleBackColor = True
        '
        'txtMaQL
        '
        Me.txtMaQL.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtMaQL.Location = New System.Drawing.Point(231, 19)
        Me.txtMaQL.MaxLength = 50
        Me.txtMaQL.Name = "txtMaQL"
        Me.txtMaQL.Size = New System.Drawing.Size(138, 22)
        Me.txtMaQL.TabIndex = 130
        '
        'Button4
        '
        Me.Button4.Image = CType(resources.GetObject("Button4.Image"), System.Drawing.Image)
        Me.Button4.Location = New System.Drawing.Point(343, 468)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(88, 24)
        Me.Button4.TabIndex = 129
        '
        'gridSearch
        '
        Me.gridSearch.AutoGenerateColumns = False
        DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
        DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control
        DataGridViewCellStyle1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText
        DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight
        DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText
        DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
        Me.gridSearch.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1
        Me.gridSearch.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
        Me.gridSearch.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.MaquanlyDataGridViewTextBoxColumn1, Me.MatailieuDataGridViewTextBoxColumn, Me.tentailieu, Me.SothutuDataGridViewTextBoxColumn})
        Me.gridSearch.DataSource = Me.TblquanlySOPSearchBindingSource
        DataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
        DataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window
        DataGridViewCellStyle2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        DataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText
        DataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight
        DataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText
        DataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.[False]
        Me.gridSearch.DefaultCellStyle = DataGridViewCellStyle2
        Me.gridSearch.Location = New System.Drawing.Point(25, 209)
        Me.gridSearch.Name = "gridSearch"
        DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
        DataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control
        DataGridViewCellStyle3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        DataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText
        DataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight
        DataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText
        DataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
        Me.gridSearch.RowHeadersDefaultCellStyle = DataGridViewCellStyle3
        Me.gridSearch.Size = New System.Drawing.Size(744, 253)
        Me.gridSearch.TabIndex = 128
        '
        'MaquanlyDataGridViewTextBoxColumn1
        '
        Me.MaquanlyDataGridViewTextBoxColumn1.DataPropertyName = "maquanly"
        Me.MaquanlyDataGridViewTextBoxColumn1.HeaderText = "Mã quản lý"
        Me.MaquanlyDataGridViewTextBoxColumn1.Name = "MaquanlyDataGridViewTextBoxColumn1"
        Me.MaquanlyDataGridViewTextBoxColumn1.Width = 120
        '
        'MatailieuDataGridViewTextBoxColumn
        '
        Me.MatailieuDataGridViewTextBoxColumn.DataPropertyName = "matailieu"
        Me.MatailieuDataGridViewTextBoxColumn.HeaderText = "Mã tài liệu"
        Me.MatailieuDataGridViewTextBoxColumn.Name = "MatailieuDataGridViewTextBoxColumn"
        Me.MatailieuDataGridViewTextBoxColumn.ReadOnly = True
        Me.MatailieuDataGridViewTextBoxColumn.Width = 120
        '
        'tentailieu
        '
        Me.tentailieu.DataPropertyName = "tentailieu"
        Me.tentailieu.HeaderText = "Tên tài liệu"
        Me.tentailieu.Name = "tentailieu"
        Me.tentailieu.Width = 300
        '
        'SothutuDataGridViewTextBoxColumn
        '
        Me.SothutuDataGridViewTextBoxColumn.DataPropertyName = "sothutu"
        Me.SothutuDataGridViewTextBoxColumn.HeaderText = "Số TT"
        Me.SothutuDataGridViewTextBoxColumn.Name = "SothutuDataGridViewTextBoxColumn"
        Me.SothutuDataGridViewTextBoxColumn.Width = 150
        '
        'TblquanlySOPSearchBindingSource
        '
        Me.TblquanlySOPSearchBindingSource.DataMember = "tbl_quanlySOPSearch"
        Me.TblquanlySOPSearchBindingSource.DataSource = Me.DataSetSearch
        '
        'DataSetSearch
        '
        Me.DataSetSearch.DataSetName = "DataSetSearch"
        Me.DataSetSearch.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
        '
        'frmQuanLySOP
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.LightBlue
        Me.ClientSize = New System.Drawing.Size(792, 573)
        Me.ControlBox = False
        Me.Controls.Add(Me.TabMain)
        Me.Controls.Add(Me.Label1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmQuanLySOP"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Danh Muc Quan Ly tai Lieu SOP"
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.TblquanlysopBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.DataSetForm_Sop, System.ComponentModel.ISupportInitialize).EndInit()
        Me.TabMain.ResumeLayout(False)
        Me.TabThongTin.ResumeLayout(False)
        Me.TabThongTin.PerformLayout()
        Me.TabTimKiem.ResumeLayout(False)
        Me.TabTimKiem.PerformLayout()
        CType(Me.gridSearch, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.TblquanlySOPSearchBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.DataSetSearch, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private data1 As DataTable
    Private da As MySqlDataAdapter
    Dim myDT As New DataTable
    Dim strError As String = ""
    Dim myform As Form
    Dim sqlQuery As String = ""
    Dim stateTaoMoi As Boolean = False
    Dim stateCapnhat As Boolean = False


    Dim currentFileName As String = ""

    Dim stateButton As Integer = 0

    Sub SetclearData()
        txtMaQuanLy.Text = ""
        Me.comboMa.Text = ""
        txtNoiLuu.Text = ""
        TxtSoBan.Text = ""
        TxtTenTaiLieu.Text = ""
    End Sub


    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        ' Kiểm tra có nhập liệu chưa ?
        Dim txtMaTinh = Me.txtMaQuanLy.Text.Trim
        sqlQuery = "SELECT maquanly FROM tbl_quanlysop WHERE maquanly = '" & txtMaTinh & "'"
        Dim existedMaTinh As Integer = moduleDatabaseConn.CheckRecordExisted(sqlQuery)
        currentFileName = Me.txtNoiLuu.Text

        'file 
        Dim fileName As String = ""
        Dim folderPath As String = ""
        folderPath += "\\"

        If globalVariale.DbServerHost = "localhost" Then
            folderPath += "127.0.0.1"
        Else
            folderPath += globalVariale.DbServerHost
        End If

        folderPath += "\"
        folderPath += globalVariale.FOLDERUPLOAD
        folderPath += "\"
        fileName = Replace(currentFileName, " ", "_")
        'fileName = currentFileName
        If My.Computer.FileSystem.FileExists(folderPath & fileName) = True Then
            fileName = Today.Year & "-" & Today.Month & "-" & Today.Day & "_" & fileName
            MessageBox.Show(fileName)
        End If
        'cap nhat 
        If existedMaTinh = 1 Then
            moduleConstants.MessageWarning = "Mã  " & txtMaQuanLy.Text & " đã có , bạn muốn cập nhật không ?"
            If MessageBox.Show(moduleConstants.MessageWarning, globalVariale.msgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = MsgBoxResult.Yes Then
                ' Update record
                If Me.checkInput(txtMaQuanLy.Text, TxtTenTaiLieu.Text) = True Then
                    ' Update record
                    Try
                        My.Computer.FileSystem.CopyFile(Me.txtNoiLuu.Text.Trim, folderPath & fileName, True)
                    Catch ex As Exception
                        MessageBox.Show("không thể copy lên máy chủ ")
                        Me.txtMaQuanLy.Focus()
                    End Try
                    sqlQuery = "UPDATE tbl_quanlysop  "
                    sqlQuery += "SET "
                    sqlQuery += " maquanly= '" & txtMaTinh & "'"
                    sqlQuery += ", masotailieu = '" & Me.comboMa.Text.Trim & "'"
                    sqlQuery += ", tentailieu = '" & Me.TxtTenTaiLieu.Text.Trim & "'"
                    sqlQuery += ", banso = '" & Me.TxtSoBan.Text.Trim & "'"
                    sqlQuery += ", ngaybanhanh = '" & Format(CDate(Me.TxtNgayBanHanh.Text.Trim), "yyyy-MM-dd") & "' "
                    sqlQuery += ", ngaycapnhat = '" & Format(CDate(Me.TxtNgayCapNhat.Text.Trim), "yyyy-MM-dd") & "' "
                    sqlQuery += ", noiluu = '" & fileName & "'"
                    sqlQuery += " WHERE maquanly= '" & txtMaTinh & "'"
                    Dim updated As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                    If updated = 1 Then
                        MessageBox.Show("Cập nhật thông tin thành công !")
                        sqlQuery = "SELECT * FROM tbl_quanlysop "
                        Me.loadDanhSachQuanLySop(sqlQuery)
                        Me.SetclearData()
                        Me.stateCapnhat = False
                    Else
                        MessageBox.Show("Cập nhật thông tin không thành công: " & globalVariale.sqlMsgError)
                    End If
                End If
            End If
        Else
            'khanh ky
            '2008 05 30
            'start add
            sqlQuery = "SELECT masotailieu FROM tbl_quanlysop where masotailieu = '" & Me.comboMa.Text & "'"
            Dim data As DataTable = moduleDatabaseConn.GetDataTable(sqlQuery)
            'end
            If existedMaTinh = 0 Then ' Insert record
                If data.Rows.Count <> 0 Then
                    MessageBox.Show("Không được chọn mã tài liệu trùng nhau !!!")
                    Me.comboMa.Focus()
                Else
                    If Me.checkInput(txtMaQuanLy.Text, TxtTenTaiLieu.Text) = True Then
                        Try
                            My.Computer.FileSystem.CopyFile(Me.txtNoiLuu.Text.Trim, folderPath & fileName, True)
                        Catch ex As Exception
                            MessageBox.Show("không thể copy lên máy chủ ")
                            Me.txtMaQuanLy.Focus()
                        End Try
                        sqlQuery = "INSERT INTO tbl_quanlysop  "
                        sqlQuery += "(maquanly,masotailieu,tentailieu,banso,ngaybanhanh,ngaycapnhat,noiluu) "
                        sqlQuery += "VALUES "
                        sqlQuery += "("
                        sqlQuery += "'" & txtMaTinh.ToUpper & "', "
                        sqlQuery += "'" & Me.comboMa.Text.Trim & "', "
                        sqlQuery += "'" & Me.TxtTenTaiLieu.Text.Trim & "', "
                        sqlQuery += "'" & Me.TxtSoBan.Text.Trim & "', "
                        sqlQuery += "'" & Format(CDate(Me.TxtNgayBanHanh.Text.Trim), "yyyy-MM-dd") & "', "
                        sqlQuery += "'" & Format(CDate(Me.TxtNgayCapNhat.Text.Trim), "yyyy-MM-dd") & "', "
                        sqlQuery += "'" & fileName & "'"
                        sqlQuery += ")"
                        Dim inserted As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                        If inserted = 1 Then
                            MessageBox.Show("Thêm thông tin thành công !")
                            sqlQuery = "SELECT * FROM tbl_quanlysop "
                            Me.loadDanhSachQuanLySop(sqlQuery)
                            SetclearData()
                        Else
                            MessageBox.Show("Thêm thông tin không thành công: " & globalVariale.sqlMsgError)
                            Me.stateTaoMoi = False
                        End If
                    Else
                        MessageBox.Show("Không được chọn mã tài liệu trùng nhau !!!", "Lấy dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                        Me.comboMa.Focus()
                    End If
                End If
            End If
        End If

    End Sub

    Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
        SetclearData()
        txtMaQuanLy.Focus()
        Me.txtMaQuanLy.ReadOnly = False
        Me.stateTaoMoi = True
        Me.stateCapnhat = False
    End Sub


    Private Sub btnDelete1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete1.Click
        Dim txtMaTinh As String = Trim(Me.txtMaQuanLy.Text)

        If txtMaTinh = "" Then
            MessageBox.Show("Bạn chưa chọn Mã để xóa !")
        Else
            Dim txtTenTinh As String = Trim(Me.comboMa.Text)
            moduleConstants.MessageWarning = "Bạn có muốn xóa  " & txtMaTinh & "(" & txtTenTinh & ") ?"
            If MessageBox.Show(moduleConstants.MessageWarning, globalVariale.msgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = MsgBoxResult.Yes Then
                Dim sqlQuery As String = "DELETE FROM tbl_quanlysop  WHERE maquanly= '" & txtMaTinh & "'"
                Dim deleting As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                If deleting = 1 Then
                    'xoa file tren server 
                    If My.Computer.FileSystem.FileExists(Me.getPath(Me.txtNoiLuu.Text)) = True Then
                        Try
                            'delete file cu~
                            My.Computer.FileSystem.DeleteFile(Me.getPath(Me.txtNoiLuu.Text))
                        Catch ex As Exception
                            MessageBox.Show("không thể xoá file trên máy chủ ")
                            Me.txtMaQuanLy.Focus()
                        End Try
                    End If
                    MessageBox.Show("Xóa thông tin thành công !")
                    sqlQuery = "SELECT * FROM tbl_quanlysop "
                    Me.loadDanhSachQuanLySop(sqlQuery)
                    SetclearData()
                Else
                    MessageBox.Show("Xóa thông tin không thành công: " & globalVariale.sqlMsgError)
                End If
            End If
        End If
        Me.stateTaoMoi = False
        Me.stateCapnhat = False
    End Sub
    Private Sub frmQuanLySOP_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        moduleUtils.setDinhDangVietNam()
        Me.loadDanhSachQuanLySop("SELECT * FROM tbl_quanlysop")
        Me.stateTaoMoi = False
        Me.loadMaSoTaiLieu()
        Me.txtMaQuanLy.ReadOnly = True
        Me.txtNoiLuu.ReadOnly = True
        Me.TxtNgayBanHanh.Text = Today
        Me.TxtNgayCapNhat.Text = Today

        '*******************
        Me.CboBoPhanBanHanh.Enabled = False
        Me.CboLoaiTaiLieu.Enabled = False
        Me.TxtSoThuTu.Enabled = False
        Me.CboSoLanBanHanh.Enabled = False
        Me.txtMaSearch.Enabled = False

        Me.TxtTenBoPhanBanHanh.Enabled = False
        Me.TxtTenLoaiTaiLieu.Enabled = False
        Me.TxtSoLanBanHanh.Enabled = False

        Me.txtMaQL.Enabled = True
        Me.optMaQL.Checked = True

        '*********** SEARCH
        Me.loadDanhSachBoPhanBanHanh()
        Me.loadDanhSachLoaiTaiLieu()
        Me.loadDanhSachSoLanBanHanh()
    End Sub
    Private Sub BtnIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnIn.Click
        '  FrmCrQuocGia.Show()
    End Sub

    Function checkInput(ByVal ma As String, ByVal ten As String) As Boolean
        Dim result As Boolean = True
        If ma = "" Then
            MessageBox.Show("Bạn chưa chọn Mã  !")
            Me.txtMaQL.Focus()
            result = False
        ElseIf ten = "" Then
            MessageBox.Show("Bạn chưa nhập tên !")
            Me.TxtTenTaiLieu.Focus()
            result = False
        ElseIf Me.txtNoiLuu.Text = "" Then
            MessageBox.Show("Bạn chưa chọn tài liệu PDF để ban hành !")
            result = False
            Me.Button2.Focus()
        ElseIf IsNumeric(Me.TxtSoBan.Text) = False Then
            MessageBox.Show(" Bạn phải nhập 'Số bản' là số !")
            result = False
            Me.TxtSoBan.Focus()
        End If

        Return result
    End Function

    Private Sub loadDanhSachQuanLySop(ByVal sqlQuery As String)
        Me.DataGridView1.DataSource = moduleDatabaseConn.GetDataTable(sqlQuery)
    End Sub

    Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Me.stateCapnhat = True
        Dim iRow As Integer = Me.DataGridView1.CurrentRow.Index
        Me.txtMaQuanLy.Text = Me.DataGridView1.Item(0, iRow).Value
        Me.comboMa.Text = Me.DataGridView1.Item(1, iRow).Value
        Me.TxtTenTaiLieu.Text = Me.DataGridView1.Item(2, iRow).Value
        Me.TxtSoBan.Text = Me.DataGridView1.Item(3, iRow).Value
        Me.TxtNgayBanHanh.Text = Me.DataGridView1.Item(4, iRow).Value
        Me.TxtNgayCapNhat.Text = Me.DataGridView1.Item(5, iRow).Value
        Me.txtNoiLuu.Text = Me.DataGridView1.Item(6, iRow).Value
    End Sub

    Private Sub DPTNgayBanHanh_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DPTNgayBanHanh.ValueChanged
        Me.TxtNgayBanHanh.Text = Me.DPTNgayBanHanh.Value
    End Sub

    Private Sub DPTNgayCapNhat_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DPTNgayCapNhat.ValueChanged
        Me.TxtNgayCapNhat.Text = Me.DPTNgayCapNhat.Value
    End Sub

    '****** Doc File Acrobat
    <DllImport("kernel32.dll")> _
    Public Shared Function WinExec(ByVal lpCmdLine As String, ByVal wType As Integer) As Integer
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim filePath As String = Me.getPath(Me.txtNoiLuu.Text)
        Dim acrobat As String = globalVariale.ACROBAT
        Try
            If My.Computer.FileSystem.FileExists(acrobat) = True Then
                WinExec("""" & acrobat & """ " & filePath & "", 8)
            Else
                MessageBox.Show("Bạn chưa cài đặt phần mềm đọc file PDF !!!")
            End If
        Catch ex As Exception
            MessageBox.Show("Bạn chưa chọn tài liệu để mở !!!")
            Me.txtMaQuanLy.Focus()
        End Try
    End Sub

    Private Function cutPath(ByVal filePath As String) As String
        Dim result As String = ""
        Dim X As Integer
        For X = Len(filePath$) To 3 Step -1
            If Mid$(filePath$, X, 1) = "\" Then
                result = Mid$(filePath$, X + 1)
                Exit For
            End If
        Next X

        cutPath = result
    End Function

    Function getPath(ByVal fileName As String)


        Dim folderPath As String = ""
        Try
            folderPath += "\\"
            folderPath += globalVariale.DbServerHost

            If folderPath = "localhost" Then
                folderPath = "127.0.0.1"
            End If

            folderPath += "\"
            folderPath += globalVariale.FOLDERUPLOAD
            folderPath += "\"
            fileName = Replace(fileName, " ", "_")

        Catch ex As Exception
            MessageBox.Show("Không thể lấy đường dẫn file ")
        End Try

        Return folderPath & fileName

    End Function


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If Me.stateTaoMoi = True Or Me.stateCapnhat = True Then
            Me.openFile.DefaultExt = "*.pdf"
            Me.openFile.Filter = "File type (*.pdf) | *.pdf"
            Me.openFile.ShowDialog()
            currentFileName = cutPath(Me.openFile.FileName)
            Me.txtNoiLuu.Text = currentFileName
        Else
            MessageBox.Show("Bạn chưa chọn file để thao tác!!!")
            Me.txtMaQL.Focus()
        End If

    End Sub

    '*********************************************
    Private Sub loadMaSoTaiLieu()
        Dim sqlQuery As String = "SELECT matailieu, mabophanbanhanh, loaitailieu, sothutu, solanbanhanh  FROM tbl_mahoatailieu"
        Dim data1 As DataTable
        data1 = moduleDatabaseConn.GetDataTable(sqlQuery)
        Me.comboMa.Items.Clear()
        Me.comboMa.ColumnNum = 5
        Me.comboMa.ColumnWidth = "121;100;100;100;100"
        Me.comboMa.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
        Me.comboMa.HighlightBorderColor = Color.Black
        Me.comboMa.GridLineHorizontal = True
        Me.comboMa.GridLineVertical = True
        Me.comboMa.ItemHeight = 17
        Me.comboMa.DropDownHeight = 300
        Me.comboMa.SourceDataTable = data1
        Me.comboMa.SelectedIndex = 0
    End Sub


    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click
        Me.Close()
    End Sub


    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.Close()
    End Sub

    '************************ SEARCH
    Private Sub loadDanhSachBoPhanBanHanh()
        Dim sqlQuery As String = ""
        sqlQuery = "SELECT ma, ten FROM tbl_bophanbanhanh ORDER BY ma"
        Dim data1 As DataTable
        data1 = moduleDatabaseConn.GetDataTable(sqlQuery)
        CboBoPhanBanHanh.Items.Clear()
        CboBoPhanBanHanh.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
        CboBoPhanBanHanh.ColumnNum = 2
        CboBoPhanBanHanh.ColumnWidth = "100;250"
        CboBoPhanBanHanh.HighlightBorderColor = Color.Black
        CboBoPhanBanHanh.GridLineHorizontal = True
        CboBoPhanBanHanh.GridLineVertical = True
        CboBoPhanBanHanh.ItemHeight = 17
        CboBoPhanBanHanh.DropDownHeight = 300
        CboBoPhanBanHanh.SourceDataTable = data1
        CboBoPhanBanHanh.SelectedIndex = 0
    End Sub
    Private Sub loadDanhSachSoLanBanHanh()
        Dim sqlQuery As String = ""
        sqlQuery = "SELECT ma, ten FROM tbl_solanbanhanh ORDER BY ma"
        Dim data3 As DataTable
        data3 = moduleDatabaseConn.GetDataTable(sqlQuery)
        CboSoLanBanHanh.Items.Clear()
        CboSoLanBanHanh.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
        CboSoLanBanHanh.ColumnNum = 2
        CboSoLanBanHanh.ColumnWidth = "100;250"
        CboSoLanBanHanh.HighlightBorderColor = Color.Black
        CboSoLanBanHanh.GridLineHorizontal = True
        CboSoLanBanHanh.GridLineVertical = True
        CboSoLanBanHanh.ItemHeight = 17
        CboSoLanBanHanh.DropDownHeight = 300
        CboSoLanBanHanh.SourceDataTable = data3
        CboSoLanBanHanh.SelectedIndex = 0
    End Sub
    Private Sub loadDanhSachLoaiTaiLieu()
        Dim sqlQuery As String = ""
        sqlQuery = "SELECT ma,ten FROM tbl_loaitailieu ORDER BY ma"
        Dim data2 As DataTable
        data2 = moduleDatabaseConn.GetDataTable(sqlQuery)
        CboLoaiTaiLieu.Items.Clear()
        CboLoaiTaiLieu.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
        CboLoaiTaiLieu.ColumnNum = 2
        CboLoaiTaiLieu.ColumnWidth = "100;250"
        CboLoaiTaiLieu.HighlightBorderColor = Color.Black
        CboLoaiTaiLieu.GridLineHorizontal = True
        CboLoaiTaiLieu.GridLineVertical = True
        CboLoaiTaiLieu.ItemHeight = 17
        CboLoaiTaiLieu.DropDownHeight = 300
        CboLoaiTaiLieu.SourceDataTable = data2
        CboLoaiTaiLieu.SelectedIndex = 0
    End Sub
    Private Sub CboBoPhanBanHanh_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CboBoPhanBanHanh.SelectedIndexChanged
        Me.TxtTenBoPhanBanHanh.Text = Me.CboBoPhanBanHanh.SelectedItem.Col2
    End Sub
    Private Sub CboSoLanBanHanh_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CboSoLanBanHanh.SelectedIndexChanged
        Me.TxtSoLanBanHanh.Text = Me.CboSoLanBanHanh.SelectedItem.Col2
    End Sub
    Private Sub CboLoaitaiLieu_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CboLoaiTaiLieu.SelectedIndexChanged
        Me.TxtTenLoaiTaiLieu.Text = Me.CboLoaiTaiLieu.SelectedItem.Col2
    End Sub
    Private Sub btnTimKiem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimKiem.Click
        sqlQuery = "SELECT quanly.maquanly , matailieu ,quanly.tentailieu , mabophanbanhanh ,sothutu  FROM tbl_mahoatailieu as mahoa, tbl_quanlysop as quanly where mahoa.matailieu = quanly.masotailieu"
        If Me.optMaQL.Checked = True Then
            sqlQuery += " and quanly.maquanly like '%" & Me.txtMaQL.Text & "%'"
        ElseIf Me.optMa.Checked = True Then
            sqlQuery += " and mahoa.matailieu like '%" & Me.txtMaSearch.Text & "%'"
        ElseIf Me.optBophan.Checked = True Then
            sqlQuery += " and mahoa.mabophanbanhanh = '" & Me.CboBoPhanBanHanh.SelectedItem.Col2 & "'"
        ElseIf Me.optLoai.Checked = True Then
            sqlQuery += " and mahoa.loaitailieu = '" & Me.CboLoaiTaiLieu.SelectedItem.Col2 & "'"
        ElseIf Me.optSo.Checked = True Then
            sqlQuery += " and mahoa.sothutu = '" & Me.TxtSoThuTu.Text & "'"
        ElseIf Me.optLan.Checked = True Then
            sqlQuery += " and mahoa.solanbanhanh = '" & Me.CboSoLanBanHanh.SelectedItem.Col2 & "'"
        Else
            MessageBox.Show("Không tìm thấy thông tin  ? ", "Tìm kiếm ", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
        Me.gridSearch.DataSource = moduleDatabaseConn.GetDataTable(sqlQuery)

    End Sub

    Private Sub optMa_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optMa.Click
        Me.CboBoPhanBanHanh.Enabled = False
        Me.CboLoaiTaiLieu.Enabled = False
        Me.TxtSoThuTu.Enabled = False
        Me.CboSoLanBanHanh.Enabled = False
        Me.txtMaSearch.Enabled = True
        Me.txtMaQL.Enabled = False

        Me.TxtTenBoPhanBanHanh.Enabled = False
        Me.TxtTenLoaiTaiLieu.Enabled = False
        Me.TxtSoLanBanHanh.Enabled = False
    End Sub

    Private Sub optSo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optSo.Click
        Me.CboBoPhanBanHanh.Enabled = False
        Me.CboLoaiTaiLieu.Enabled = False
        Me.TxtSoThuTu.Enabled = True
        Me.CboSoLanBanHanh.Enabled = False
        Me.txtMaSearch.Enabled = False
        Me.txtMaQL.Enabled = False

        Me.TxtTenBoPhanBanHanh.Enabled = False
        Me.TxtTenLoaiTaiLieu.Enabled = False
        Me.TxtSoLanBanHanh.Enabled = False

    End Sub

    Private Sub optLoai_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optLoai.Click
        Me.CboBoPhanBanHanh.Enabled = False
        Me.CboLoaiTaiLieu.Enabled = True
        Me.TxtSoThuTu.Enabled = False
        Me.CboSoLanBanHanh.Enabled = False
        Me.txtMaSearch.Enabled = False
        Me.txtMaQL.Enabled = False

        Me.TxtTenBoPhanBanHanh.Enabled = False
        Me.TxtTenLoaiTaiLieu.Enabled = True
        Me.TxtSoLanBanHanh.Enabled = False
    End Sub

    Private Sub optLan_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optLan.Click
        Me.CboBoPhanBanHanh.Enabled = False
        Me.CboLoaiTaiLieu.Enabled = False
        Me.TxtSoThuTu.Enabled = False
        Me.CboSoLanBanHanh.Enabled = True
        Me.txtMaSearch.Enabled = False
        Me.txtMaQL.Enabled = False

        Me.TxtTenBoPhanBanHanh.Enabled = False
        Me.TxtTenLoaiTaiLieu.Enabled = False
        Me.TxtSoLanBanHanh.Enabled = True
    End Sub
    Private Sub optBophan_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optBophan.Click
        Me.CboBoPhanBanHanh.Enabled = True
        Me.CboLoaiTaiLieu.Enabled = False
        Me.TxtSoThuTu.Enabled = False
        Me.CboSoLanBanHanh.Enabled = False
        Me.txtMaSearch.Enabled = False
        Me.txtMaQL.Enabled = False

        Me.TxtTenBoPhanBanHanh.Enabled = True
        Me.TxtTenLoaiTaiLieu.Enabled = False
        Me.TxtSoLanBanHanh.Enabled = False

    End Sub

    Private Sub optMaQL_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optMaQL.Click
        Me.CboBoPhanBanHanh.Enabled = False
        Me.CboLoaiTaiLieu.Enabled = False
        Me.TxtSoThuTu.Enabled = False
        Me.CboSoLanBanHanh.Enabled = False
        Me.txtMaSearch.Enabled = False

        Me.TxtTenBoPhanBanHanh.Enabled = False
        Me.TxtTenLoaiTaiLieu.Enabled = False
        Me.TxtSoLanBanHanh.Enabled = False

        Me.txtMaQL.Enabled = True
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'khanh ky
        '2008-05-20
        Try
            Dim noiluu As String = ""
            Dim iRow As Integer = Me.gridSearch.CurrentRow.Index
            Dim maquanly As String = Me.gridSearch.Item(0, iRow).Value
            sqlQuery = "SELECT noiluu FROM tbl_quanlysop where maquanly = '" & maquanly & "'"
            Dim tmp As DataTable = moduleDatabaseConn.GetDataTable(sqlQuery)
            noiluu = tmp.Rows.Item(0).Item(0)
            Dim filePath As String = Me.getPath(noiluu)
            Dim acrobat As String = globalVariale.ACROBAT

            'If noiluu.Trim.Substring(noiluu.Trim.Length - 4, 4) <> ".pdf" Then ' Chua chay
            '    filePath += noiluu & ".pdf"
            'Else
            '    filePath += noiluu
            'End If
            If My.Computer.FileSystem.FileExists(acrobat) = True Then
                WinExec("""" & acrobat & """ " & filePath & "", 8)
            Else
                MessageBox.Show("Bạn chưa cài đặt phần mềm đọc file PDF !!!")
            End If
        Catch ex As Exception
            MessageBox.Show("Không tìm thấy tài liệu trên máy chủ !!!")
        End Try

        'khanh ky
        '2008-05-20
    End Sub

End Class


